package com.example.dg.controller;

import com.example.dg.entity.Gwc;
import com.example.dg.mapper.GwcMapper;
import com.example.dg.service.GwcServive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/Gwc")
public class GwcController {

    @Autowired
    GwcServive gwcServive;

    @Autowired
    private GwcMapper dao = null;

    /**显示*/
    @PostMapping("/spper")
    public List<Gwc> Students(@RequestBody Gwc gwc){
        System.out.println(gwcServive.getAllGwc(gwc));
        return gwcServive.getAllGwc(gwc);
    }

    /**删除*/
    @DeleteMapping("/{id}")
    public int del(@PathVariable String id){
        return gwcServive.del(id);
    }

    /**批量删除*/
    @CrossOrigin
    @RequestMapping("/Btndelete")
    public boolean Btndelete(Integer ids[]){
        System.out.println("批量删除了："+ids.length + ids);
//        for(Integer id : ids){
//            System.out.println(id);
//        }
        return dao.Btndelete(ids);
    }

}
